package com.suxiaoxiao.springbootlearn.designpattern.compoundpattern.duck;

import com.suxiaoxiao.springbootlearn.designpattern.compoundpattern.Quackable;
import com.suxiaoxiao.springbootlearn.designpattern.compoundpattern.observer.Observable;
import com.suxiaoxiao.springbootlearn.designpattern.compoundpattern.observer.Observer;

/**
 * 橡皮鸭
 * @author 、
 */
public class RubberDuck implements Quackable {

    Observable observable;

    public RubberDuck() {
        observable = new Observable(this);
    }

    @Override
    public void quack() {
        System.out.println("Squeak");
    }

    @Override
    public void registerObserver(Observer observer) {
        observable.registerObserver(observer);
    }

    @Override
    public void notifyObserver() {
        observable.notifyObserver();
    }
}
